<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <link rel="icon" href="../../images/hospital-icon.png" type="image/x-icon">  <!--在网页标题左侧显示图标-->
    <!--    <link rel="shortcut icon" href="./images/hospital-icon.png" type="image/x-svg">-->
    <link rel="shortcut icon" href="../../images/hospital-icon.png" type="image/x-icon"><!--在收藏夹显示图标-->

    <title>药库库存管理-门诊管理系统</title>

    <!--时间风格及输入框风格-->
    <!--pickers css-->
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-datepicker/css/datepicker-custom.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-timepicker/css/timepicker.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-colorpicker/css/colorpicker.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-datetimepicker/css/datetimepicker-custom.css" />

    <link href="../../css/style.css" rel="stylesheet">
    <link href="../../css/style-responsive.css" rel="stylesheet">
    <!--时间风格及输入框风格-->

    <!--data table-->
    <link rel="stylesheet" href="../../js/data-tables/DT_bootstrap.css" />

    <link href="../../css/style.css" rel="stylesheet">
    <link href="../../css/style-responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="../../js/html5shiv.js"></script>
    <script src="../../js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="sticky-header">

<section>
    <!-- left side start-->
    <!--左侧开始-->
    <div class="left-side sticky-left-side">

        <!--logo and iconic logo start-->
        <!--侧边栏顶部图标+文字-->
        <div class="logo">
            <a href="index_pharmacy.html">
                <img src="../../images/hospital-icon.png" alt="" style="width: 40px;height: 40px">
                <p style="display: inline-block;font-size: 24px;">门诊管理系统</p>
            </a>
        </div>

        <!--收起状态的侧边栏顶部图标-->
        <div class="logo-icon text-center">
            <a href="index_pharmacy.html"><img src="../../images/hospital-icon.png" alt="" style="width: 40px;height: 40px"></a>
        </div>
        <!--logo and iconic logo end-->

        <div class="left-side-inner">

            <!--sidebar nav start-->
            <!--侧边栏-->
            <ul class="nav nav-pills nav-stacked custom-nav">


                <li class="menu-list nav-active">
                    <a href="">
                        <i class="fa fa-cogs"></i>
                        <span>药库管理</span>
                    </a>
                    <ul class="sub-menu-list">
                        <li class="active"><a href="drugInfoList.html"> 药库库存管理</a></li>
                        <li><a href="itemList.html"> 产品管理</a></li>
                        <li><a href="pickingList.html"> 捡药发药管理</a></li>
                        <li><a href="prescriptionList.html"> 处方管理</a></li>
                    </ul>
                </li>

                <li class="logout">
                    <a href="#">
                        <i class="fa fa-sign-in"></i>
                        <span>退出登录</span>
                    </a>
                </li>

            </ul>
            <!--sidebar nav end-->
            <!--侧边栏导航结束-->

        </div>
    </div>
    <!-- left side end-->
    <!-- 左侧 部分 结束 -->

    <!-- main content start-->
    <div class="main-content" >

        <!-- header section start-->
        <!--顶部菜单部分开始-->
        <div class="header-section">

            <!--toggle button start-->
            <!--拨动按钮-收起侧边栏-->
            <a class="toggle-btn"><i class="fa fa-bars"></i></a>
            <!--toggle button end-->

            <!--notification menu start -->
            <!--通知菜单开始-->
            <div class="menu-right" id="headerApp">
                <ul class="notification-menu">

                    <li>
                        <a href="#" class="btn btn-default  info-number logout">
                            退出登录
                            <i class="fa fa-sign-out"></i>
                        </a>
                    </li>

                </ul>
            </div>
            <!--notification menu end -->
            <!--通知菜单结束-->
        </div>
        <!-- header section end-->
        <!--顶部菜单部分结束-->

        <!--body wrapper start-->
        <div class="wrapper" id="drugInfoApp">
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">
                        <header class="panel-heading">
                            药库库存管理
                            <span class="tools pull-right"></span>
                        </header>
                        <div class="panel-body">
                            <div class="adv-table editable-table ">

                                <div class="clearfix"  style="margin-bottom: 20px">
                                    <form class="form-inline" role="form">

                                        <a href="#newAdmission" class="btn btn-info details" data-toggle="modal">
                                            新增
                                            <i class="fa fa-plus"></i>
                                        </a>

                                        <!-- Modal -->
                                        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="newAdmission" class="modal fade">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header" style="width: auto;height: auto">
                                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                        <h4 class="modal-title">新增库存</h4>
                                                    </div>
                                                    <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">选择产品:</label>
                                                            <div class="col-sm-8">
                                                                <input v-model="addDrugInfoInput" @change="addSelectDrugInfoList()" data-toggle="dropdown" type="text" class="form-control dropdown-toggle" style="width: 300px" placeholder="根据产品名称查询">
                                                                <ul role="menu" class="dropdown-menu" style="position: absolute;right: 15px;width: 100%">
                                                                    <li v-for="item in addItemList">
                                                                        <a href="#" @click="drugAddCheckThisItem(item.itemId,item.itemName,item.itemSpecificationDetail,item.manufacturerName,item.manufacturerApprovalId)">
                                                                            <span v-text="item.itemId">1</span>
                                                                            <span> </span>
                                                                            <span v-text="item.itemName"> 产品名称</span>
                                                                            <span> </span>
                                                                            <span v-text="item.itemSpecificationDetail"> 包装规格</span>
                                                                            <span> </span>
                                                                            <span v-text="item.manufacturerName"> 厂家名称</span>
                                                                            <span>（</span>
                                                                            <span>国药准字号：</span>
                                                                            <span v-text="item.manufacturerApprovalId">国药准字号</span>
                                                                            <span>）</span>
                                                                        </a>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">选择药房:</label>
                                                            <div class="col-sm-8">
                                                                <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                                    <span v-text="addCheckDepartmentName">选择药房</span>
                                                                    <span class="caret"></span>
                                                                </button>
                                                                <ul role="menu" class="dropdown-menu">
                                                                    <li v-for="PHMdepartment in departmentPHM">
                                                                        <a href="#" @click="addDrugCheckThisDepartment(PHMdepartment.id,PHMdepartment.departmentName)">
                                                                            <span v-text="PHMdepartment.departmentName">门诊药房</span>
                                                                        </a>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">库存量</label>
                                                            <div class="col-sm-8">
                                                                <input v-model="addDrugInfoTotalQty" class="col-sm-12" type="text" class="form-control" placeholder="请输入库存量">
                                                            </div>
                                                        </div>
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">基本单位名称</label>
                                                            <div class="col-sm-8">
                                                                <input v-model="addDrugInfoUnitName" class="col-sm-12" type="text" class="form-control" placeholder="请输入基本单位名称">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                        <button type="button" class="btn btn-success" @click="addDrugInfoButton()">保存</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="btn-group">
                                            <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                <span v-text="pageSizeName">分页数</span>
                                                <span class="caret"></span>
                                            </button>
                                            <ul role="menu" class="dropdown-menu">
                                                <li><a href="#" @click="selectDrugInfoCheckThisPageSize(10)">10</a></li>
                                                <li><a href="#" @click="selectDrugInfoCheckThisPageSize(20)">20</a></li>
                                                <li><a href="#" @click="selectDrugInfoCheckThisPageSize(30)">30</a></li>
                                            </ul>
                                        </div>

                                        <div class="btn-group">
                                            <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                <span v-text="drugInfoSelectCheckDepartmentName">选择药房</span>
                                                <span class="caret"></span>
                                            </button>
                                            <ul role="menu" class="dropdown-menu">
                                                <li v-for="PHMdepartment in departmentPHM">
                                                    <a href="#" @click="selectDrugInfoCheckThisDepartment(PHMdepartment.id,PHMdepartment.departmentName)">
                                                        <span v-text="PHMdepartment.departmentName">门诊药房</span>
                                                    </a>
                                                </li>
                                            </ul>
                                        </div>

                                        <div class="form-group">
                                            <input v-model="selectDrugInfoForItemName" type="text" class="form-control" style="width: 300px" placeholder="根据产品名称模糊查询">
                                        </div>

                                        <button type="button" class="btn btn-info" @click="selectDrugInfoButton()">
                                            查询
                                            <i class="fa fa-search"></i>
                                        </button>
                                        <button type="button" class="btn btn-default" @click="selectDrugInfoButtonReset()">
                                            重置
                                            <i class="fa fa-undo"></i>
                                        </button>

                                    </form>
                                </div>


                                <table class="table table-striped table-hover table-bordered" id="editable-sample">
                                    <thead>
                                    <tr>
                                        <th>药库存量ID</th>
                                        <th>药房ID</th>
                                        <th>药房名称</th>
                                        <th>产品ID</th>
                                        <th>产品详情</th>
                                        <th>数量基本单位名称</th>
                                        <th>可用存量</th>
                                        <th>冻结预存量</th>
                                        <th>总数量</th>
                                        <th>创建时间</th>
                                        <th>修改</th>
                                        <th>删除</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr class="" v-for="drugInfo in drugInfoList">
                                        <td v-text="drugInfo.stockId">1</td>
                                        <td v-text="drugInfo.departmentId">1</td>
                                        <td>
                                            <span class="label label-info" v-text="drugInfo.departmentIdName">门诊药房</span>
                                        </td>
                                        <td v-text="drugInfo.itemId">1</td>
                                        <td v-text="drugInfo.itemDescription">阿莫西林克拉维酸钾片</td>
                                        <td v-text="drugInfo.unitName">盒</td>
                                        <td v-text="drugInfo.availableQty">30</td>
                                        <td v-text="drugInfo.freezeQty">15</td>
                                        <td v-text="drugInfo.totalQty">45</td>
                                        <td v-text="drugInfo.returnCreateTime">1999-02-28</td>
                                        <td>
                                            <a href="#modifyDrugInfo" class="details" style="color: #46b8da;" data-toggle="modal" @click="modifyDrugInfoButton(drugInfo.stockId)">修改</a>
                                        </td>

                                        <td>
                                            <a :href="'#deleteyDrugInfo' + drugInfo.stockId" class="details" style="color: #46b8da;" data-toggle="modal">删除</a>
                                            <!-- Modal -->
                                            <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" :id="'deleteyDrugInfo' + drugInfo.stockId" class="modal fade">
                                                <div class="modal-dialog">
                                                    <div class="modal-content">
                                                        <div class="modal-header" style="width: auto;height: auto">
                                                            <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                            <h4 class="modal-title">删除库存记录</h4>
                                                        </div>
                                                        <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                            <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                                <label class="col-sm-4 control-label">是否确认删除库存</label>
                                                            </div>
                                                        </div>
                                                        <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                            <button type="button" class="btn btn-success" @click="saveModifyDeleteStockButton(drugInfo.stockId)">保存</button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>

                                    </tbody>
                                </table>

                                <!--修改组件-->
                                <!-- Modal -->
                                <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="modifyDrugInfo" class="modal fade">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header" style="width: auto;height: auto">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">修改药库存量</h4>
                                            </div>
                                            <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">药库存量ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.stockId" class="col-sm-12" type="text" class="form-control" placeholder="请输入药库存量ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">药房ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.departmentId" class="col-sm-12" type="text" class="form-control" placeholder="请输入药房ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">药房名称</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.departmentIdName" class="col-sm-12" type="text" class="form-control" placeholder="请输入药房名称" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">产品ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.itemId" class="col-sm-12" type="text" class="form-control" placeholder="请输入产品ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">产品详情</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.itemDescription" class="col-sm-12" type="text" class="form-control" placeholder="请输入产品详情" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">数量基本单位名称</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.unitName" class="col-sm-12" type="text" class="form-control" placeholder="请输入数量基本单位名称" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">可用存量</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.availableQty" @change="modifyChangAvailableQty()" class="col-sm-12" type="text" class="form-control" placeholder="请输入可用存量">
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">冻结预存量</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.freezeQty" class="col-sm-12" type="text" class="form-control" placeholder="请输入冻结预存量" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">总数量</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyDrugInfo.totalQty" @change="modifyChangTotalQty()" class="col-sm-12" type="text" class="form-control" placeholder="请输入总数量">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                <button type="button" class="btn btn-success" @click="saveModifyDrugInfo(modifyDrugInfo.stockId)">保存</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="clearfix">
                                    <div class="btn-group">

                                    </div>
                                    <div class="btn-group pull-right">
                                        <ul class="pagination pagination-sm">
                                            <li><a href="#"  @click.prevent="loadDrugInfoList(pageinfo.prePage)">上一页</a></li>
                                            <li v-for="n in pageinfo.navigatepageNums" @click.prevent="loadDrugInfoList(n)" :class="{'active': n == pageinfo.pageNum}">
                                                <a href="#" v-text="n">1</a>
                                            </li>
                                            <li><a href="#" @click.prevent="loadDrugInfoList(pageinfo.nextPage)">下一页</a></li>
                                        </ul>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->
        <!--页脚部分开始-->
        <footer>
            2022 &copy; <a href="https://gitee.com/allen-zc/OutpatientManagementSystem" target="_blank">基于SSM的门诊管理系统</a>
            -
            <a href="https://gitee.com/allen-zc" target="_blank">AllenChen曾晨</a>
            -
            <p style="display: inline-block">ALL RIGHTS RESERVED.</p>
        </footer>
        <!--footer section end-->
        <!--页脚部分结束-->


    </div>
    <!-- main content end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="../../js/jquery-1.10.2.min.js"></script>
<script src="../../js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="../../js/jquery-migrate-1.2.1.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/modernizr.min.js"></script>
<script src="../../js/jquery.nicescroll.js"></script>

<!--时间风格及输入框风格-->
<!--pickers plugins-->
<script type="text/javascript" src="../../js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="../../js/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<!--pickers initialization-->
<script src="../../js/pickers-init.js"></script>
<!--时间风格及输入框风格-->

<!--data table-->
<script type="text/javascript" src="../../js/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="../../js/data-tables/DT_bootstrap.js"></script>

<!--common scripts for all pages-->
<script src="../../js/scripts.js"></script>


<script src="https://unpkg.zhimg.com/vue"></script>
<!--&lt;!&ndash; 开发环境版本，包含了有帮助的命令行警告 &ndash;&gt;-->
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>-->
<!--&lt;!&ndash; 生产环境版本，优化了尺寸和速度 &ndash;&gt;-->
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>-->
<!--axios-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

<!--菜单顶部导航栏-->
<script src="../../userjs/header.js"></script>
<!--表格设置-->
<script src="../../user/admin/js/user_list.js"></script>

<!--退出登录的方法-->
<script  type="text/javascript" charset="GB2312"  src="../../userjs/logout.js"></script>
<!--工具箱-->
<script src="../../js/utils.js"></script>


<script>

    let drugInfoApp = new Vue({
        el:'#drugInfoApp',
        data:{
            addDrugInfoId:'',
            addDrugInfoInput:'',
            addItemList:[],
            addDrugInfoTotalQty:'',
            addDrugInfoUnitName:'',
            departmentPHM:[],
            addCheckDepartmentId:'',
            addCheckDepartmentName:'选择药房',

            selectDrugInfoForItemName:'',
            drugInfoSelectCheckDepartmentName:'选择药房',
            selectDepartmentId:'',
            pageSizeName:'分页数',
            pageSize:'10',
            pageNum:'1',
            drugInfoList:[],
            pageinfo:{},

            modifyDrugInfo:{}

        },
        methods:{
            // 新增 搜索产品
            addSelectDrugInfoList:function () {
                let itemName = this.addDrugInfoInput
                let form=new FormData();
                form.append("itemName",itemName);
                axios({
                    url:"/oms/item/selectItemList",
                    method:"post",
                    data:form
                }).then(function (res) {
                    drugInfoApp.addItemList = res.data.list
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 新增 选择产品
            drugAddCheckThisItem:function (itemId,itemName,itemSpecificationDetail,manufacturerName,manufacturerApprovalId) {
                this.addDrugInfoId = itemId,
                    this.addDrugInfoInput = itemId + ' ' + itemName + ' ' + itemSpecificationDetail + ' ' + manufacturerName + ' ' + manufacturerApprovalId
            },
            // 新增 加载药房
            addLoadDepartmentDrug:function () {
                let form=new FormData();
                form.append("pharmacyFlag",'1');
                axios({
                    url:"/oms/department/selectDepartmentList",
                    method:"post",
                    data:form
                }).then(function (res) {
                    drugInfoApp.departmentPHM = res.data.list
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 新增 选择药房
            addDrugCheckThisDepartment:function (departmentId,departmentName) {
                this.addCheckDepartmentId = departmentId
                this.addCheckDepartmentName = departmentName
            },
            // 新增 新增库存
            addDrugInfoButton:function () {
                let form=new FormData();
                form.append("departmentId",this.addCheckDepartmentId);
                form.append("itemId",this.addDrugInfoId);
                form.append("totalQty",this.addDrugInfoTotalQty);
                form.append("unitName",this.addDrugInfoUnitName);
                axios({
                    url:"/oms/drug/addDrugInfo",
                    method:"post",
                    data:form
                }).then(function (res) {
                    if (res.data=='ok'){
                        alert("新增成功")
                        location.reload();
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 查询 查询按钮
            selectDrugInfoButton:function () {
                if (this.pageNum==null||this.pageNum==''){
                    this.pageNum = 1
                }
                if (this.pageSize==null||this.pageSize==''){
                    this.pageSize = 10
                }

                let form=new FormData();
                form.append("departmentId",this.addCheckDepartmentId);
                form.append("itemDescription",this.selectDrugInfoForItemName);
                form.append("pageNum",this.pageNum);
                form.append("pageSize",this.pageSize);
                axios({
                    url:"/oms/drug/selectDrugInfoList",
                    method:"post",
                    data:form
                }).then(function (res) {
                    drugInfoApp.drugInfoList = res.data.list
                    drugInfoApp.pageinfo = res.data
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 搜索 选择药房
            selectDrugInfoCheckThisDepartment:function (departmentId,departmentName) {
                this.selectDepartmentId = departmentId;
                this.drugInfoSelectCheckDepartmentName = departmentName;
            },
            // 搜索 选择分页数
            selectDrugInfoCheckThisPageSize:function (pageSize) {
                this.pageSizeName = pageSize
                this.pageSize = pageSize
            },
            // 修改 修改按钮
            modifyDrugInfoButton:function (stockId) {
                let form=new FormData();
                form.append("stockId",stockId);
                axios({
                    url:"/oms/drug/selectDrugInfoDetail",
                    method:"post",
                    data:form
                }).then(function (res) {
                    drugInfoApp.modifyDrugInfo = res.data

                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 修改 保存修改信息
            saveModifyDrugInfo:function (stockId) {
                let form=new FormData();
                form.append("stockId",stockId);
                form.append("availableQty",this.modifyDrugInfo.availableQty);
                form.append("freezeQty",this.modifyDrugInfo.freezeQty);
                form.append("totalQty",this.modifyDrugInfo.totalQty);
                axios({
                    url:"/oms/drug/updateDrugInfo",
                    method:"post",
                    data:form
                }).then(function (res) {
                    if (res.data=='ok'){
                        alert("修改成功")
                        location.reload();
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 修改 修改可用量
            modifyChangAvailableQty:function () {
                this.modifyDrugInfo.totalQty = this.modifyDrugInfo.availableQty - 0 + this.modifyDrugInfo.freezeQty
            },
            // 修改 修改总量
            modifyChangTotalQty:function () {
                this.modifyDrugInfo.availableQty = this.modifyDrugInfo.totalQty - this.modifyDrugInfo.freezeQty
            },
            // 删除 确认删除
            saveModifyDeleteStockButton:function (stockId) {
                axios({
                    url:"/oms/drug/deleteDrugInfo/" + stockId,
                    method:"get",
                }).then(function (res) {
                    if (res.data=='ok'){
                        alert("删除成功")
                        location.reload();
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 查询 重置
            selectDrugInfoButtonReset:function () {
                this.selectDrugInfoForItemName=''
                this.drugInfoSelectCheckDepartmentName='选择药房'
                this.selectDepartmentId=''
                this.pageSizeName='分页数'
                this.pageSize='10'
                this.pageNum='1'
                this.drugInfoList=[]
                this.pageinfo={}
                this.selectDrugInfoButton()
            },
            // 上一页 下一页
            loadDrugInfoList:function (pageNum) {
                this.pageNum = pageNum
                this.selectDrugInfoButton()
            }
        },
        created:function () {
            this.addLoadDepartmentDrug()
            this.selectDrugInfoButton()
        }
    })

</script>

</body>
</html>
